package com.isoft.systemprovidor.service;

import com.isoft.systemprovidor.dao.ExternalManageDao;
import com.isoft.systemprovidor.entity.ExternalManage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
@Slf4j
public class ExternalManageService {
    @Autowired
    ExternalManageDao externalManageDao;
    /*获取外聘须知*/
    public ExternalManage getExternalManage(){
        return externalManageDao.getExternalManage();
    }
    /*修改外聘须知*/
    public boolean updataExternal(ExternalManage externalManage){
        // 检查 最后修改人 是否为空
        if (externalManage.getLastmodifier() == null || externalManage.getLastmodifier().isEmpty()) {
            log.error("getlastmodifier不能为空");
            return false;
        }
        //最后修改时间
        externalManage.setLastdate(new Date());

        return externalManageDao.updataExternal(externalManage)>0;
    }
}
